package com.it.service;

import com.it.dao.BookMapper;
import com.it.pojo.Books;

import java.util.List;

public class BookServiceImpl implements BookService {

    /**
     * service层调用dao层，组合dao，可以在上增加方法
     */

    private BookMapper bookMapper;

    //这样就可以交给spring托管了(set方法注入)
    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    public int addBook(Books books) {
        return bookMapper.addBook(books);
    }

    public int deleteBooK(int id) {
        return bookMapper.deleteBooK(id);
    }

    public int updateBook(Books books) {
        return bookMapper.updateBook(books);
    }

    public Books findByID(int id) {
        return bookMapper.findByID(id);
    }

    public List<Books> findAll() {
        return bookMapper.findAll();
    }

}
